
#__Author__  = white



shopping=[("book",100),("hat",30),("gift",100)]
salary=input("your salary:")
if salary.isdigit():
    salary= int(salary)
else:
    exit()

shopping_cart=[]

for i in shopping:
    print(shopping.index(i),i)



while 1:
    code=input("input code:")
    if code.isdigit():
        code1=int(code)
        if code1<3 and code1>=0:

            if salary>=shopping[code1][1]:

                shopping_cart.append(shopping[code1])
                print(shopping_cart)
                salary -= shopping[code1][1]
            else:
                print("your money not enough")
                break
    elif code=='q':
        exit()

for i in shopping_cart:
    print(i)
